<extend name="./base" />
<block name="title">
    <title>qzone后台登录</title>
</block>
<block name="main">
    <div class="container">

        <form class="form-signin" action="" onsubmit="return false;">
            <div class="form-signin-heading text-center">
                <h1 class="sign-title">登录</h1>
                <img src="__PUBLIC__/images/login-logo.png" alt=""/>
            </div>
            <div class="login-wrap">
                <input type="text" class="form-control" placeholder="用户名" autofocus name="username">
                <input type="password" class="form-control" placeholder="密码" name="passwd">

                <button class="btn btn-lg btn-login btn-block" type="登录">
                    <i class="fa fa-check"></i>
                </button>
                <label class="checkbox">
                    <input type="checkbox" value="0" name="rememberMe"> 记住我
                <span class="pull-right">
                    <a data-toggle="modal" href="#myModal"> 忘记密码</a>
                </span>
                </label>
            </div>

        </form>
        <!-- Modal -->
        <div aria-hidden="true" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" id="myModal" class="modal fade">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title">忘记密码 ?</h4>
                    </div>
                    <div class="modal-body">
                        <p>输入您的邮箱地址我们将发送一封验证邮件，请点击验证邮件里的链接来验证您的身份修改密码！.</p>
                        <input type="text" name="email" placeholder="Email" autocomplete="off" class="form-control placeholder-no-fix">

                    </div>
                    <div class="modal-footer">
                        <button data-dismiss="modal" class="btn btn-default" type="button">取消</button>
                        <button class="btn btn-primary" type="button">提交</button>
                    </div>
                </div>
            </div>
        </div>
        <!-- modal -->
    </div>
</block>
<block name="script">
    <script>
        $('.btn-login').click(function(){
            if($("input[name='username']").val() == '' || $("input[name='passwd']").val() == '')
            {
                //激活模态框并显示相对应的提示！
                activateModal("登录出现问题！","请把表单填写完整后再提交！","alert-danger");
                return false;
            }
            $.ajax({
                type:'post',
                data:$('form').serialize(),
                success:function (data) {
                    if(data.status == 1)
                    {
                        //登录失败
                        activateModal("登录出现问题！","帐号或者密码错误！","alert-danger");
                        return false;
                    }else if(data.status == 0)
                    {
                        window.location.href="{:U('Index/index')}";
                    }
                }
            });
        });
    </script>
</block>